package com.qiangqiang.task.server.mapper.provider;

import com.qiangqiang.task.server.entity.Commission;
import com.qiangqiang.task.server.entity.Follow;
import org.apache.ibatis.jdbc.SQL;

import java.util.Map;

/**
 * @program: task
 * @description:
 * @author: Sky.lin
 * @create: 2019-03-10 16:26
 **/
public class CommissionProvider extends BaseProvider {
    public String insertCommission(final Map<String, Object> map) {
        Commission commission = (Commission) map.get("commission");
        return generateInsertSQL(Commission.class);
    }

    public String queryAllCommissionByUserId(final Map<String, Object> map) {
        long userId = (long) map.get("userId");
        SQL sql = new SQL() {
            {
                SELECT("*");
                FROM("commission");
                WHERE("user_id=" + userId);
            }
        };
        StringBuffer sb = new StringBuffer(sql.toString());
        sb.append(getLimit(1, 10));
        return sql.toString();
    }
}
